define(
    function (require) {
        require('tpl!./form.tpl.html');

        var u = require('underscore');
        var ubRiaUtil = require('ub-ria/util');

        var BaseFormView = require('common/FormView');

        function FormView() {
            BaseFormView.apply(this, arguments);
        }

        FormView.prototype.template = 'equipmentForm';

        FormView.prototype.enterDocument = function() {
            BaseFormView.prototype.enterDocument.apply(this, arguments);
        };

        /**
         * 从表单中获取实体数据
         *
         * @return {Object}
         */
        FormView.prototype.getEntity = function () {
            var entity = BaseFormView.prototype.getEntity.apply(this, arguments);
            var  flg =true;
            var lon = /^-?((0|[1-9]\d?|1[1-7]\d)(\.\d{1,7})?|180(\.0{1,7})?)?$/;
            var lat = /^-?((0|[1-8]\d|)(\.\d{1,7})?|90(\.0{1,7})?)?$/;
            var lonRe = new RegExp(lon);
            var latRe = new RegExp(lat);

            if (!lonRe.test(entity.longitude)) {
                flg = false;
                alert("经度不符合规范：经度整数部分为0-180,小数部分为0-6位！");
            }

            if (!latRe.test(entity.latitude)) {
                flg = false;
                alert("纬度不符合规范：纬度整数部分为0-90,小数部分为0-6位！！");
            }
            if(flg){
                return entity;
            }
        };

        require('er/util').inherits(FormView, BaseFormView);
        return FormView;
    }
);
